package homeWorkk;

import java.math.BigDecimal;

public class work1 {
    public static void main(String[] args) {
        double[] arr = {0.1,0.2,2.1,3.2,5.56,7.21};
        BigDecimal bigDecimal = new BigDecimal("0");

        for (int i = 0; i < arr.length; i++) {
            bigDecimal = bigDecimal.add(BigDecimal.valueOf(arr[i]));
        }
        System.out.println(bigDecimal);


        BigDecimal avg=bigDecimal.divide(BigDecimal.valueOf(arr.length),2,BigDecimal.ROUND_HALF_UP);
        System.out.println(avg);
    }
}
